-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(functions): add 1.5GB and 3GB memory options for v2 #9503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(functions): add 1.5GB and 3GB memory options for v2 #9503
Conversation
kdawgwilk
commented
Nov 21, 2025
- Extend memory option types/mappings to include 1536MB and 3072MB with display labels.
- Map new sizes to sensible v2 CPU defaults (1 CPU for 1.5GB, 2 CPU for 3GB) and keep gen1 allowed set unchanged.
- Add validation guard so gen1 rejects unsupported memory values; update coverage to allow new sizes for v2 and assert the gen1 rejection.
Summary of ChangesHello @kdawgwilk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the flexibility of function deployments by adding new memory configuration options (1.5GB and 3GB) and updating their corresponding CPU allocations for v2 functions. It also improves robustness by implementing validation to ensure that GCF generation 1 functions are restricted to their supported memory values. Additionally, the changes incorporate support for the latest Node.js 24 runtime. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively adds support for 1.5GB and 3GB memory options for GCFv2 functions. The changes include updating the necessary type definitions, constants, and mappings, as well as adding validation to prevent these new options from being used with GCFv1. The accompanying tests are well-written and cover the new functionality and validation logic.
I have a couple of suggestions to improve maintainability. One is to address code duplication for memory option definitions across different files. The other is to keep the scope of this PR focused by moving unrelated changes for nodejs24 to a separate PR. Overall, this is a solid contribution.
| export type MemoryOption = | ||
| | 128 | ||
| | 256 | ||
| | 512 | ||
| | 1024 | ||
| | 1536 | ||
| | 2048 | ||
| | 3072 | ||
| | 4096 | ||
| | 8192 | ||
| | 16384 | ||
| | 32768; | ||
| const allMemoryOptions: MemoryOption[] = [ | ||
| 128, 256, 512, 1024, 1536, 2048, 3072, 4096, 8192, 16384, 32768, | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a duplication of memory option definitions here and in src/deploy/functions/backend.ts. To improve maintainability and avoid having to update memory options in multiple places, we should define these constants in a single location.
I suggest we make src/deploy/functions/backend.ts the single source of truth for memory options. You can remove MemoryOption and allMemoryOptions from this file. Additionally, the type is named MemoryOption here, but MemoryOptions in backend.ts. Consolidating them would also resolve this inconsistency.
To fix the error message in toBackend (line 516), you'll need to:
- Export
allMemoryOptionsfromsrc/deploy/functions/backend.ts. - Import
allMemoryOptionsin this file (src/deploy/functions/build.ts).
This will centralize the memory option definitions and make future updates easier.
| it("identifies nodejs24 as a valid runtime", () => { | ||
| expect(supported.isRuntime("nodejs24")).to.be.true; | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Extend memory option types/mappings to include 1536MB and 3072MB with display labels. - Map new sizes to sensible v2 CPU defaults (1 CPU for 1.5GB, 2 CPU for 3GB) and keep gen1 allowed set unchanged. - Add validation guard so gen1 rejects unsupported memory values; update coverage to allow new sizes for v2 and assert the gen1 rejection.
c5f62ca to
c340d73
Compare